home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / amiga / gcc233lb.lha / unranlib / README next >
Text File  |  1993-01-03  |  2KB  |  39 lines

  1.  
  2. Please delete this subdirectory.
  3.  
  4. The code here is an ugly five- (okay, ten-) minute hack I wrote to strip
  5. corrupted __.SYMDEF headers from ar archives.  It assumes an old-style
  6. ar file header which I got from a SysV man page and the ar(1) man page with
  7. Markus Wild's gcc 2.3.3 distribution says it doesn't use any more.  But
  8. I dunno, it works.
  9.  
  10. Here is the source, and the executable, compiled with Manx Aztec C 5.2.
  11. It takes the names of a bunch of .a files on the command line (sorry, no
  12. pattern matching provided!), renames them to .a.bak, and copes a "clean"
  13. version to the original .a filename.  It does *not* delete the .a.bak
  14. file, as an added safety precaution.  It quits on encountering any error.
  15.  
  16. The code is totally uncommented, but pretty darn straightforward.
  17. It goes through the argv array, moving the files around then opening
  18. them, then calls unranlib(in,out) on the file handles.
  19.  
  20. unranlib() checks the input for the ar magic cookie, then a __.SYMDEF
  21. header.  If it sees this, it goes into a loop searching for the next
  22. file header, since the __.SYMDEF's size is corrupted.  When it encounters
  23. two characters that look like a magic file flag ("`\n"), it validates the
  24. preceding file header to see if it looks like it should, with all fields
  25. in ASCII (mostly decimal numbers, but mode in octal), padded at the end
  26. with spaces.  If it fails the test, it keeps looking.
  27.  
  28. When it finally gets a header, it copies out the ar magic cookie,
  29. then the just-input file headewr, then copies the rest of the input
  30. file to the output in 512-byte chunks.
  31.  
  32. Wasn't that exciting?  If you run ranlib on the result, you get the
  33. files that are included in the rest of this archive.
  34.  
  35. Oh, yes: no copyright is claimed on this code.  It's in the public domain,
  36. free to use or abuse.
  37. -- 
  38.     -Colin (colin@nyx.cs.du.edu)
  39.